﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace cnFederal
{
    /// <summary>
    /// Summary description for ImgHandler
    /// </summary>
    public class ImgHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
           
            string id = context.Request.QueryString["id"];
            if (!string.IsNullOrWhiteSpace(id))
            {
                int imgId = Convert.ToInt32(id);
                CnfImage img = CnfImages.GetImageById(imgId);
                if (img != null)
                    context.Response.BinaryWrite(img.Image.ToArray());

            }

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}